package com.woniu.order.client;

import com.woniu.model.Result;
import com.woniu.order.cliententity.entity.TUser;
import com.woniu.order.cliententity.entity.UserAddrees;
import com.woniu.order.cliententity.form.AddCredibilityForm;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@FeignClient(name = "user-server",path = "/user")
public interface UserClient {
    /**
     * 根据id查询用户
     * @param userId 用户id
     * @return
     */
    @GetMapping("/tUser/userById/{userId}.api")
    @ApiOperation("根据id查询用户")
    Result<TUser> userById(@PathVariable("userId") Long userId);

    /**
     * 根据id查询地址信息
     * @param addressId 地址id
     * @return
     */
    @GetMapping("/userAddrees/addressById/{addressId}")
    @ApiOperation("根据id查询地址信息")
     Result<UserAddrees> addressById(@PathVariable("addressId") Long addressId);


    /**
     * 根据用户id添加积分
     * @param form
     * @return
     */
    @PostMapping("/tUser/addCredibility.api")
    @ApiOperation("修改用户信誉分")
    public Result<TUser> addCredibility(@RequestBody @Validated AddCredibilityForm form);

    /**
     * 根据账号id查询用户
     * @param accountId 用户账号id
     * @return
     */
    @GetMapping("/tUser/byAccountId/{accountId}")
    @ApiOperation("根据账号id查询用户")
    Result<TUser> byAliPayUsername(@PathVariable("accountId") Long accountId);
}
